//
//  BSKAnnotationView.m
//  MicroMemory
//
//  Created by rimi on 16/7/21.
//  Copyright © 2016年 BlueSky. All rights reserved.
//

#import "BSKAnnotationView.h"

@implementation BSKAnnotationView

- (instancetype)initWithAnnotation:(id<MKAnnotation>)annotation reuseIdentifier:(NSString *)reuseIdentifier
{
	self = [super initWithAnnotation:annotation reuseIdentifier:reuseIdentifier];
	if (self) {
		[self loadUI];
	}
	return self;
}

-(void)loadUI{
	self.bounds = CGRectMake(0,0, 50, 50);
	UIImageView * v = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"notetip"]];
	v.frame =CGRectMake(0, 0, 50, 50);
	[self addSubview:v];
	self.canShowCallout = YES;
	UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(click)];
	[self addGestureRecognizer:tap];
}

-(void)click{
	if (self.selected) {
		if (_clickCallback) {
			_clickCallback(_noteIndex);
		}
	}
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
